{include file="public/nheader" /}
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input name="title" class="layui-input" type="text" placeholder="用户名|身份证|手机号" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="status">
                                <option value="">状态</option>
                                <option value="1" {if !empty(input('get.status')) &&
                                    input('get.status')==1}selected{/if}>待审核</option>
                                <option value="2" {if !empty(input('get.status')) &&
                                    input('get.status')==2}selected{/if}>已打款</option>
                                <option value="3" {if !empty(input('get.status')) &&
                                    input('get.status')==3}selected{/if}>驳回申请</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>搜索</button>
                        <!-- // 打开添加页面 -->
                        <button class="layui-btn icon-btn layui-bg" lay-maxmin="true" lay-open="" data-title="银行卡提现"
                            data-area="60%,80%" data-url="/agent/withdraw_edit">银行卡提现(每月固定日期打款)
                        </button>
                        {if !empty($agent['openid'])}
                        <button class="layui-btn icon-btn layui-bg-cyan" lay-maxmin="true" lay-open="" data-title="微信提现"
                            data-area="60%,80%" data-url="/agent/withdraw_edit2">微信提现(1-3天到款)
                        </button>
                        {/if}
                    </div>
                </div>
            </div>
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    {{#  if(d.status ==1){ }}
    {{#  if(d.type ==1){ }}
    <a class="layui-table-text" data-url="/agent/withdraw_status?id={{d.id}}&status=2" data-confirm="您确认已收款成功吗" lay-ajax="" data-reload="self">我已收款</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text layui-color-red" data-url="/agent/withdraw_status?id={{d.id}}&status=3" data-confirm="确认取消提现吗" lay-ajax="" data-reload="self">取消提现</a>
    <div class="layui-divider layui-divider-vertical"></div>
    {{#  } }}
    {{#  if(d.type ==2){ }}
    <span class="layui-badge layui-bg-orange">自动转账中</span>
    {{#  } }}
    {{# }if(d.status ==2) { }}
    <span class="layui-badge layui-bg-orange">已打款</span>
    {{# }if(d.status ==3) { }}
    <span class="layui-badge layui-bg-green">已驳回</span>
    {{#  } }}

</script>
{include file="public/nfooter"}
<script>
    layui.use(['table'], function () {
        var table = layui.table;        // 表格
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList",
            where: {
                agentid: "{:input('agentid/d',0)}"
            }
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , even: true
            , toolbar: 'true'
            , defaultToolbar: ['filter', 'print', 'exports']
            , cols: [[
                { type: 'checkbox', width: 60 },
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                {
                    field: 'bank', width: 150, align: 'center', title: '开户行', templet: function (d) {
                        if (d.type == 2) {
                            return '<button class="layui-btn icon-btn layui-bg-cyan">' + d.bank + '</button>';
                        }
                        return '<button class="layui-btn icon-btn">' + d.bank + '</button>';
                    }
                },
                { field: 'name', align: 'center', width: 120, title: '开户名' },
                {
                    field: 'cards', width: 200, align: 'center', title: '卡号', templet: function (d) {
                        if (d.type == 2) {
                            return '微信转账';
                        }
                        return d.cards;
                    }
                },
                { field: 'bank', width: 150, align: 'center', title: '开户行' },
                {
                    field: 'money', align: 'center', width: 120, templet: function (d) {
                        return '<a style="color:blue" class="layui-table-text" lay-open data-title="订单记录" data-area="90%,90%" data-url="/agent/agentlog?agentid=' + d.user_id + '" >' + d.money + '</a>';
                    }, title: '提现金额'
                },
                { field: 'fee', width: 150, align: 'center', title: '手续费' },
                {
                    field: 'sk', align: 'center', width: 120, templet: function (d) {
                        return (d.money - d.fee).toFixed(2);
                    }, title: '实际收款'
                },
                {
                    field: 'text', width: 150, align: 'center', title: '驳回理由', templet: function (d) {
                        if (!d.text) {
                            return text = '无';
                        }
                        return d.text;
                    }
                },
                {
                    field: 'status', align: 'center', width: 120, templet: function (d) {
                        var text = '';
                        if (d.status == 1) {
                            text = '<span class="layui-badge layui-bg-blue">待审核</span>';
                        }
                        if (d.status == 2) {
                            text = '<span class="layui-badge layui-bg-orange">已打款</span>';
                        }
                        if (d.status == 3) {
                            text = '<span class="layui-badge layui-bg-green">已驳回</span>';
                        }
                        return text;

                    }, title: '类型'
                },
                { field: 'created', width: 150, align: 'center', title: '提交时间' },
                { align: 'center', toolbar: '#tableBar', width: 250, title: '操作' },
            ]]
        })
    })
</script>
{if empty($agent['openid'])}
<script>
    //二维码生成链接
    // var urlen = encodeURIComponent('{$qrcode|raw}');
     //var url = "https://my.tv.sohu.com/user/a/wvideo/getQRCode.do?width=1000&height=1000&text=" + urlen;
    //弹窗
     //layer.open({
        //type:1 表示页面层
      //   type: 1,
     //    title: '截图保存微信内识别二维码绑定微信快速提现',
        //是否点击遮罩关闭
     //    shadeClose: true,
        //样式类名，可以自定义弹窗样式
        //弹层外区域
     //    shade: 0.3,
     //    maxmin: false, //开启最大化最小化按钮
        //宽高
     //    area: ['350px', '350px'],
        //内容
     //    content: "<img src='" + url + "' alt='' style='width:90%;height:90%;margin:0 auto;display:block'>",
     //   //弹窗下方的按钮
    //});
</script>
{/if}
</body>